package com.info33.platform.business.dialogue.controller;

import com.alibaba.fastjson.JSONObject;
import com.info33.platform.business.dialogue.dao.AiSessionRecordDao;
import com.info33.platform.business.dialogue.dto.AiSessionRecordDTO;
import com.info33.platform.common.mvc.controller.BaseController;
import com.info33.platform.business.dialogue.entity.AiSessionRecord;
import com.info33.platform.business.dialogue.service.AiSessionRecordService;
import com.info33.platform.common.mvc.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

/**
 * @author LF
 * @date 2023-10-16 10:09:15
 */
@RestController
@RequestMapping("/AiSessionRecord")
@Api(tags = "人工智能_会话记录")
public class AiSessionRecordController extends BaseController<AiSessionRecordService, AiSessionRecord> {

    private final AiSessionRecordService aiSessionRecordService;

    @Autowired
    public AiSessionRecordController(AiSessionRecordService aiSessionRecordService) {
        super(aiSessionRecordService);
        this.aiSessionRecordService = aiSessionRecordService;
    }

    /**---------------------screen大屏---------------------*/

    /**----------------------app移动端----------------------*/

    @GetMapping("/ai/recordList")
    @ApiOperation(value = "易知微-记录列表")
    public List<JSONObject>recordList(){
        return aiSessionRecordService.recordList();
    }

    /**-----------------------pc后台-----------------------*/

    @PostMapping("/ai/askQuestion")
    @ApiOperation(value = "提问")
    public Result<String> askQuestion(@RequestBody AiSessionRecordDTO dto) throws IOException {
        return aiSessionRecordService.askQuestion(dto);
    }

    @PostMapping("/ai/updateTest")
    @ApiOperation(value = "MP根据ID修改测试")
    public Result<?> updateTest(@RequestBody AiSessionRecordDTO dto){
        return aiSessionRecordService.updateTest(dto);
    }

    @GetMapping("/ai/StreamingQuery")
    @ApiOperation("mybatisPlus流式查询测试")
    public Result<?> streamingQuery(){
        return aiSessionRecordService.streamingQuery();
    }

}
